package springboot.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author daiqiang
 * @since 2023/12/19-16:45
 * mybatis-plus分页插件
 *  IPage page = new Page(currentPage,pageSize);
 *         bookMapper.selectPage(page,lqw);
 *         return  page;
 */
    @Configuration
    @MapperScan("springboot.*.mapper")
    public class MyBatisPageConfig {
        @Bean
        public MybatisPlusInterceptor mybatisPlusInterceptor(){
            MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
            interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
            return interceptor;
        }
    }

